<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
    <h5 class="modal-title">删除统计</h5>
</div>
<div class="modal-body">
	<div class="rows">
        <div class="col-xs-offset-1 col-xs-10 col-xs-offset-1">
		<form id="form-subjectCount" class="form-horizontal">
			<div class="form-group">
				<label class="control-label col-xs-4 col-sm-3" for="subject-name">日期范围：</label>
				<div class="input-group input-group-sm" style="width: 35%;float: left;">
					<input type="text" id="delDataBegin" class="form-control" dataValid="*" placeholder="开始时间"/>
					<span class="input-group-addon"style="cursor:pointer;" id="delDataBeginImg">
						<i class="ace-icon fa fa-calendar"></i>
					</span>
				</div>
				<label class="control-label">至</label>
				<div class="input-group input-group-sm" style="width: 35%;float: right;">
					<input type="text" id="delDataEnd" class="form-control" dataValid="*" placeholder="结束时间"/>
					<span class="input-group-addon"style="cursor:pointer;" id="delDataEndImg">
						<i class="ace-icon fa fa-calendar"></i>
					</span>
				</div>
			</div>
		</form>
		</div>
	</div>
</div> 
<div class="modal-footer clearfixed">
	<div class="rows">
		<div class="col-xs-12">
		    <button type="button" class="btn btn-danger btn-xs no-border" onclick="dels();">删除</button>
		    <button type="button" class="btn btn-info btn-xs no-border" data-dismiss="modal" aria-label="Close">关闭</button>
		</div>
	</div>
</div>
<script type="text/javascript">
function dels(){
	if(!validate("form-subjectCount")){
		return false;
	}
	var params = {};
	params['delDataBegin'] = $("#delDataBegin").val();
	params['delDataEnd'] = $("#delDataEnd").val();
	var isOk = confirm('您确定要删除'+params['delDataBegin']+'至'+params['delDataEnd']+'的数据记录吗?');
	if(isOk){
		$.ajax({
			type : "POST",
			url : "mnui/sub/count/deletes",
			data : params,
			dataType: "json",
			success : function(data) {
				$("#table-subjectCount").bootstrapTable('refresh');
				hideModal();
				TipMsg.success(data.message, 0);
			}
		});
	}
}

$(function(){
	//初始化日期
	var dataBegin = {
	    elem: '#delDataBegin',
	    format: 'YYYY-MM-DD',
	    istime: false,
	    istoday: false,
	    issure: true,
	    choose: function(datas){
	    	//需要有日期差，即选择某日期后，结束日期应该从选择的日期的后一天开始
	    	var date = new Date(datas);
	    	var _date = laydate.now(date.getTime() + 86400000,"YYYY-MM-DD");//86400000ms:1day的ms值
	    	dataEnd.min = _date; //开始日选好后，重置结束日的最小日期
			dataEnd.start = _date //将结束日的初始值设定为开始日
	    }
	};
	var dataEnd = {
	    elem: '#delDataEnd',
	    format: 'YYYY-MM-DD',
	    istime: false,
	    istoday: true,
	    issure: true,
	    choose: function(datas){
	    	var date = new Date(datas);
	    	var _date = laydate.now(date.getTime() - 86400000,"YYYY-MM-DD");//86400000ms:1day的ms值
	    	dataBegin.max = _date; //结束日选好后，重置开始日的最大日期
	    }
	};
	//绑定日期控件
	$("#delDataBegin").click(function(){
		laydate(dataBegin);
	});
	$("#delDataEnd").click(function(){
		laydate(dataEnd);
	});
	$("#delDataBeginImg").click(function(){
		laydate(dataBegin);
	});
	$("#delDataEndImg").click(function(){
		laydate(dataEnd);
	});
});
</script>